package com.ruoyi.system.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

import java.util.Date;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * 采购单自动编码对象 ha_drug_pcodelist
 * 
 * @author 鲍小伟
 * @date 2025-11-28
 */
public class HaDrugPcodelist extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    private Long seqid;

    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private LocalDate curDate;

    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private Integer curNum;

    /** $column.columnComment */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String status;

    public void setSeqid(Long seqid) 
    {
        this.seqid = seqid;
    }

    public Long getSeqid() 
    {
        return seqid;
    }

    public void setCurDate(LocalDate curDate)
    {
        this.curDate = curDate;
    }

    public LocalDate getCurDate()
    {
        return curDate;
    }

    public void setCurNum(Integer curNum)
    {
        this.curNum = curNum;
    }

    public Integer getCurNum()
    {
        return curNum;
    }

    public void setStatus(String status) 
    {
        this.status = status;
    }

    public String getStatus() 
    {
        return status;
    }


    //增加一个拼接单号@鲍小伟 20251128 domain 实体类文件
    /** 辅助：拼采购单号 PYYYYMMDD-NNN */
    public String buildNo() {
        return "P" + curDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"))
                + "-" + String.format("%03d", curNum);
    }

    // 只读：拼好的单号
    public String getPurchaseNo() {
        return "P" + curDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"))
                + "-" + String.format("%03d", curNum);
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("seqid", getSeqid())
            .append("curDate", getCurDate())
            .append("curNum", getCurNum())
            .append("status", getStatus())
            .toString();
    }
}
